import 'dart:convert' show json;

class CategoryChildResult {

  bool success;
  String code;
  String message;
  List<CategoryChildBean> entity;

  CategoryChildResult.fromParams({this.success, this.code, this.message, this.entity});

  factory CategoryChildResult(jsonStr) => jsonStr == null ? null : jsonStr is String ? new CategoryChildResult.fromJson(json.decode(jsonStr)) : new CategoryChildResult.fromJson(jsonStr);

  CategoryChildResult.fromJson(jsonRes) {
    success = jsonRes['success'];
    code = jsonRes['code'];
    message = jsonRes['message'];
    entity = jsonRes['entity'] == null ? null : [];

    for (var entityItem in entity == null ? [] : jsonRes['entity']){
      entity.add(entityItem == null ? null : new CategoryChildBean.fromJson(entityItem));
    }
  }

  @override
  String toString() {
    return '{"success": $success,"code": ${code != null?'${json.encode(code)}':'null'},"message": ${message != null?'${json.encode(message)}':'null'},"entity": $entity}';
  }
}

class CategoryChildBean {

  int id;
  int level;
  int opt_id;
  int parent_opt_id;
  String image;
  String opt_name;

  CategoryChildBean.fromParams({this.id, this.level, this.opt_id, this.parent_opt_id, this.image, this.opt_name});

  CategoryChildBean.fromJson(jsonRes) {
    id = jsonRes['id'];
    level = jsonRes['level'];
    opt_id = jsonRes['opt_id'];
    parent_opt_id = jsonRes['parent_opt_id'];
    image = jsonRes['image'];
    opt_name = jsonRes['opt_name'];
  }

  @override
  String toString() {
    return '{"id": $id,"level": $level,"opt_id": $opt_id,"parent_opt_id": $parent_opt_id,"image": ${image != null?'${json.encode(image)}':'null'},"opt_name": ${opt_name != null?'${json.encode(opt_name)}':'null'}}';
  }
}

